using Plots
using LaTeXStrings
# Interpolation nodes
x = [1, 2, 3]
function L(i, z)
result = 1.0
for j in 1:length(x)
if i != j
result *= (z - x[j]) / (x[i] - x[j])
end
end
return result
end
scatter(x, ones(3), title="Lagrange polynomials")
plot!(legend=:outertopright, size=(900, 900))
plot!(z -> L(1, z), label=L"L_1")
plot!(z -> L(2, z), label=L"L_2")
plot!(z -> L(3, z), label=L"L_3")